package com.gulimall.product.web;

import com.gulimall.product.service.SkuInfoService;
import com.gulimall.product.vo.ItemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author mayifan
 * @version 1.0
 * @date 2024-12-27 16:08
 */
@Controller
public class ItemController {

    @Autowired
    SkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    public String skuItem(@PathVariable("skuId") Long skuId, Model model){
        System.out.println("准备查询"+skuId+"详情");
        ItemVo itemVo = skuInfoService.item(skuId);
        model.addAttribute("item",itemVo);
        return "item";
    }
}
